<?php

namespace app\model;

use app\BaseModel;
use think\model\relation\BelongsTo;
use app\model\not_del\RatingScaleModel as NotDelRatingScaleModel;

/**
 * 任务量表
 */
class TaskRatingScaleModel extends BaseModel
{
    protected $name = 'task_rating_scale';


    /**
     * 关联量表
     * @return BelongsTo
     */
    public function ratingScale(): BelongsTo
    {
        return $this->belongsTo(NotDelRatingScaleModel::class,'rating_scale_id')->bind([
            'rating_scale_name'=>'name',
            'rating_scale_cover'=>'cover',
        ]);
    }

    /**
     * 关联量表包
     * @return BelongsTo
     */
    public function ratingScalePack(): BelongsTo
    {
        return $this->belongsTo(RatingScalePackInfoModel::class,'pack_id')->bind(['rating_scale_pack_name'=>'name']);
    }

    /**
     * 关联任务
     * @return BelongsTo
     */
    public function task(): BelongsTo
    {
        return $this->belongsTo('TaskModel','task_id')->bind([
            'task_name'=>'name',
            'task_user_count'=>'user_count',
            'task_user_complete_num'=>'user_complete_num',
            'task_warning_num'=>'warning_num',
            'task_status'=>'status',
        ]);
    }

}